
#include <machine/asm.h>

ENTRY(strrchr)
	movl	4(%sp),%a1		| string
	movb	11(%sp),%d0		| char to look for
	subl	%a0,%a0			| clear rindex pointer
rixloop:
	cmpb	(%a1),%d0		| found our char?
	jne	rixnope			| no, check for null
	movl	%a1,%a0			| yes, remember location
rixnope:
	tstb	(%a1)+			| null?
	jne	rixloop			| no, keep going
	movl	%a0,%d0			| return value
	rts
END(strrchr)

STRONG_ALIAS(rindex,strrchr)
